import { sendRequest } from '@/http';

const baseUrl = '/admin/elder/contract';

/**
 * 查询合同列表
 */
export const queryElderContractList = (params: {
  pageNum: number;
  pageSize: number;
  elderId?: string;
  status?: string;
}) => {
  return sendRequest({
    url: `${baseUrl}/queryElderContractList`,
    method: 'get',
    params,
  });
};

/**
 * 查询合同详情
 */
export const queryElderContractDetail = (contractId: string) => {
  return sendRequest({
    url: `${baseUrl}/queryElderContractDetail`,
    method: 'get',
    params: { contractId },
  });
};

/**
 * 创建合同
 */
export const createElderContract = (data: any) => {
  return sendRequest({
    url: `${baseUrl}/createElderContract`,
    method: 'post',
    data,
  });
};

/**
 * 更新合同
 */
export const updateElderContract = (data: any) => {
  return sendRequest({
    url: `${baseUrl}/updateElderContract`,
    method: 'post',
    data,
  });
};

/**
 * 删除合同
 */
export const deleteElderContract = (contractId: string) => {
  return sendRequest({
    url: `${baseUrl}/deleteElderContract`,
    method: 'post',
    data: { contractId },
  });
};

/**
 * 生成资源上传TOKEN
 * @param data
 * @returns
 */
export const genContractFileUploadToken = (data: { localFileName: string }) => {
  return sendRequest({
    url: `${baseUrl}/genContractFileUploadToken`,
    method: 'post',
    data: data as any,
  });
};
